﻿#region

using System.IO;
using MobilePal.State;

#endregion

namespace MobilePal.Log
{
  public class FileLogger : ILogger
  {
    #region Fields

    private readonly string _filename;
    private readonly string _separator;

    #endregion

    #region Constructors/Finalizers

    public FileLogger(string filename, string separator)
    {
      _filename = filename;
      _separator = separator;
    }

    #endregion

    #region Methods

    public void DumpActivity(Activity activity)
    {
      using (StreamWriter writer = File.AppendText(_filename))
      {
        writer.WriteLine(activity.Dump(_separator));
        writer.Flush();
      }
    }

    #endregion
  }
}